﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AMS.PizzaDecoratorDemo
{
    public enum ToppingAction { Add, Remove }

    public abstract class Topping : PizzaDecorator
    {
        protected ToppingAction _action;

        public Topping(IPizza pizza, ToppingAction action)
            : base(pizza)
        {
            _action = action;
        }

        public override double GetPrice()
        {
            // topping's base value plus 25 cents per size increase from Small
            return (_action == ToppingAction.Add ? (_baseValue + (((double)Size)*.25)) : 0d) + _pizza.GetPrice();
        }

        public override string GetDescription()
        {
            string descriptor = (_action == ToppingAction.Add ? "with" : "minus");
            return String.Format("{0} {1} {2}", _pizza.GetDescription(), descriptor, _name);
        }
    }
}
